// 此文件主要是打开服务的时候就链接数据库

// 拿到mongoose驱动
const mongoose = require("mongoose");
mongoose.connect(
  "mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/chenpeng",
  {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    auth: { authSource: "admin" }
  },
  () => {
    console.log("链接数据库");
    require("./model/movies.js")  //在数据库添加movies
    require("./model/schedules.js")  //在数据库添加schedules
    require("./model/users.js")   //在数据库中添加users
    console.log('链接数据库成功',"connect mongodb://localhost:27017/chenpeng");
    require('./model/cinemas.js')   //在数据库中添加cinemas
    require("./model/theaters.js") 
    require("./model/seats.js")
    require("./model/seatings.js")
    require("./model/admin.js")
    require("./model/order.js")
  }
);
